﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Reader.Core.DataAccessObject.Models
{
    public class Book : BasicEntity<int>
    {
        /// <summary>
        /// book name
        /// </summary>
        [Required]
        [MaxLength(255)]
        public string Name { get; set; }
        /// <summary>
        /// book read position
        /// </summary>
        public string ReadPosition { get; set; }
        public string Cover { get; set; }
        public string Intro { get; set; }
        public bool UpdateInfo { get; set; }
        [Required]
        public int AuthorId { get; set; }
        [ForeignKey(nameof(AuthorId))]
        public virtual Author Author { get; set; }
        public int ShelfId { get; set; }
        [ForeignKey(nameof(ShelfId))]
        public virtual BookShelf BookShelf { get; set; }
        [MaxLength(255)]
        [Required]
        public string LocalPath { get; set; }
        [MaxLength(255)]
        public string Url { get; set; }
        public int? SiteId { get; set; }
        [ForeignKey(nameof(SiteId))]
        public virtual BookSite Site { get; set; }
        [Required]
        public bool Completed { get; set; }
    }
}
